#ifndef SDL_GL_H
#define SDL_GL_H


#ifdef ENGINE_SDL
#include <windows.h>
#include <SDL/SDL.h>
#include <SDL/SDL_opengl.h>
#endif

#ifdef ENGINE_GLFW
#include <GL/glfw.h>
#include <GL/glext.h>
#endif

#include <stdio.h>

#include "../core/mymath.h"
#include "../core/Color.h"
#include "../core/rect.h"
#include "../core/matrix4.h"


void glDefaultSetup();

inline void glColor(const Color& color)		{ glColor4ub(color.R, color.G, color.B, color.A); }
//void glVertex(const vector3f& v)			{ glVertex3f(v.x, v.y, v.z); }
//void glNormal(const vector3f& v)			{ glNormal3f(v.x, v.y, v.z); }

void glRotateq(const quatf& q);
inline void glMultMatrix(const matrix4f& m) { glMultMatrixf(m.getElements()); }

void glRenderBox(float size_x, float size_y, float size_z);
void glRenderBoxCM(float size_x, float size_y, float size_z, const Color cmat[4]);
void glRenderCube(float size_x, float size_y, float size_z);
void glRenderRect(float w, float h);
void glRenderRectCM(float w, float h, const Color cmat[4]);
vector3f glGetPoint3D(int x, int y);
vector2f glGetPoint2D(vector3f pos);

void glBeginScene3D();
void glEndScene3D();

void glBeginScene2D(float width, float height);
void glEndScene2D();

void glBeginSceneGUI(int width, int height);
void glEndSceneGUI();

void glEnableFog(Color c, int filter, float start, float end);

void glDrawRect(const rectf& r, const Color& color);
void glFillRect(const rectf& r, const Color& color);
void glFillRectCM(const rectf& r, const Color cmat[4]);

void glDrawCircle(float r, const Color& color, int segments = 18);

void glBeginPicking(int cursorX, int cursorY, float sense);
int glEndPicking();


#endif // SDL_GL_H
